package xian.woniu.web.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xian.woniu.entity.User;
import xian.woniu.service.IUserService;
import xian.woniu.util.ResultVO;


/**
 * 测试用
 * @author SongHang
 * @time 2022/05/18 19:36:11
 */
@RestController
@RequestMapping("test")
@Slf4j
public class TestController {
    @Autowired
    private IUserService userService;

    @RequestMapping("test")
    public String test(@RequestBody String str){
        System.out.println("TestController.f1"+str);
        System.out.println("TestController.test,MVC连接成功");
        return "MVC连接成功！";
    }

    @PostMapping("f1")
    public ResultVO f1(@RequestBody User user) {
        log.info("执行f1{}"+user);
        System.out.println("TestController.f1"+user);
        userService.save(user);
        return ResultVO.success("mybatis连接成功");
    }

}
